package com.ljf.authority.web;

import com.ljf.authority.dto.command.AuthorityDatPermissionGroupCommand;
import com.ljf.authority.dto.command.AuthorityDatPermissionGroupMenuCommand;
import com.ljf.authority.dto.command.AuthorityDatPermissionGroupUserCommand;
import com.ljf.authority.dto.query.AuthorityDatPermissionGroupQuery;
import com.ljf.authority.service.IAuthorityDatPermissionGroupService;
import com.ljf.authority.vo.AuthorityDatPermissionGroupVO;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.result.ResultModel;
import com.ljf.common.validation.UpdateGroup;
import com.ljf.common.web.BasisController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 权限组  控制器
 *
 * @author LJF
 * @since 2025-06-08
 */
@RestController
@RequestMapping("/authority/dat/permission_group")
@Api(value = "权限组接口", tags = "权限组接口")
public class AuthorityDatPermissionGroupController extends BasisController<IAuthorityDatPermissionGroupService, AuthorityDatPermissionGroupQuery, AuthorityDatPermissionGroupVO, AuthorityDatPermissionGroupCommand> {

    @PutMapping("/menu")
    @ApiOperation(value = "修改权限组菜单接口")
    public ResultModel editMenu(@RequestBody @Validated(UpdateGroup.class) AuthorityDatPermissionGroupMenuCommand command) throws ServiceException {
        return service.editMenu(command);
    }

    @PutMapping("/user")
    @ApiOperation(value = "修改权限组用户接口")
    public ResultModel editUser(@RequestBody @Validated(UpdateGroup.class) AuthorityDatPermissionGroupUserCommand command) throws ServiceException {
        return service.editUser(command);
    }

    @GetMapping("/menu/{id}")
    @ApiOperation(value = "查询权限组菜单接口")
    public ResultModel queryMenuById(@PathVariable Long id) throws ServiceException {
        return service.queryMenuById(id);
    }

    @GetMapping("/user/{id}")
    @ApiOperation(value = "查询权限组用户接口")
    public ResultModel queryUserById(@PathVariable Long id) throws ServiceException {
        return service.queryUserById(id);
    }

}